<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>签到修改</title>
    <script src="../layui/layui.js"></script>
    <link rel="stylesheet" href="../layui/css/layui.css">
    <script src="../js/jquery.js"></script>
    <script src="../js/myAjax.js"></script>
    <script src="../js/util/popup.js"></script>
</head>
<body>
<div style="margin-left: 80px; margin-top: 20px">
    <div type="hidden" id="signInId"></div>
    <div class="layui-form-item">
        <label class="layui-form-label">学生姓名</label>
        <div class="layui-input-inline">
            <input type="text" name="title" readonly required lay-verify="required" id="studentName" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">所属小组</label>
        <div class="layui-input-inline">
            <input type="text" name="title" readonly required lay-verify="required" id="team" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">签到状态</label>
        <div class="layui-input-inline">
            <input type="text" name="title" required lay-verify="required" id="state" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">状态补充</label>
        <div class="layui-input-inline">
            <input type="text" name="title" required lay-verify="required" id="remark" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">签到日期</label>
        <div class="layui-input-inline">
            <input type="text" name="title" readonly required lay-verify="required" id="signDate" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">点到时间</label>
        <div class="layui-input-inline">
            <input type="text" name="title" readonly required lay-verify="required" id="signTime" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">更改时间</label>
        <div class="layui-input-inline">
            <input type="text" name="title" required lay-verify="required" id="updateTime" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" onclick="editAdd('/sign/edit',getData())">立即提交</button>
            <button type="reset" onclick="resetEdit('/html/signInEdit.html')" class="layui-btn layui-btn-primary">
                点击重置
            </button>
        </div>
    </div>
</div>
<script>
    layui.use('laydate', function(){
        var laydate = layui.laydate;
        //执行一个laydate实例
        laydate.render({
            elem: '#updateTime' //指定元素
            ,type: 'datetime'
            ,format: 'yyyy-MM-dd HH:mm:ss'
        });
    });
    function getData() {
        let data = {
            id:sessionStorage.getItem("signInId"),
            state: $("#state").val(),
            remark: $("#remark").val(),
            updateTime: $("#updateTime").val(),
        }
        return data;
    }
    let id = sessionStorage.getItem("signInId")
    findById('/sign/findById',id);
    function findById(url,id) {
        let result = myAjax(url,'post',{id:id});
        $("#studentName").val(result.userName);
        $("#team").val(result.team);
        $("#state").val(result.state);
        $("#signDate").val(result.signDate);
        $("#signTime").val(result.signTime);
        $("#remark").val(result.remark);
        $("#updateTime").val(result.updateTime);
    }
</script>
</body>
</html>